﻿namespace WeiboPlus.Models
{
    public class ApplicationSetting : NotificationObject
    {
        ImageQualityTypes _imageQuality;
        public ImageQualityTypes ImageQuality
        {
            get
            {
                return _imageQuality;
            }
            set
            {
                _imageQuality = value;
                RaisePropertyChanged(() => ImageQuality);
            }
        }

        int _pageCount;
        public int PageCount
        {
            get
            {
                return _pageCount;
            }
            set
            {
                _pageCount = value;
                RaisePropertyChanged(() => PageCount);
            }
        }

        bool _geoEnable;
        public bool GeoEnable
        {
            get
            {
                return _geoEnable;
            }
            set
            {
                _geoEnable = value;
                RaisePropertyChanged(() => GeoEnable);
            }
        }

        int _queryNewInterval;
        public int QueryNewInterval
        {
            get
            {
                return _queryNewInterval;
            }
            set
            {
                _queryNewInterval = value;
                RaisePropertyChanged(() => QueryNewInterval);
            }
        }

        public static ApplicationSetting Default
        {
            get
            {
                return new ApplicationSetting()
                {
                    PageCount = 10,
                    GeoEnable = true,
                    QueryNewInterval = 1,
                    ImageQuality = ImageQualityTypes.DisplayThumb,
                    UploadImageResolution = new ImageResolution(480, 640, 50),
                    //Comment out to use system default
                    //Language = LanguageTypes.English,
                    EnableShakeToRefresh = false,
                };
            }
        }

        ImageResolution _uploadImageResolution;
        public ImageResolution UploadImageResolution
        {
            get { return _uploadImageResolution; }
            set { _uploadImageResolution = value; RaisePropertyChanged(() => UploadImageResolution); }
        }

        string _languageName;
        public string LanguageName
        {
            get
            {
                return _languageName;
            }
            set
            {
                if (value != null && _languageName != value)
                {
                    _languageName = value;
                    RaisePropertyChanged(() => LanguageName);
                }
            }
        }

        string _exThemeResourceDictionaryPath;
        public string ExThemeResourceDictionaryPath
        {
            get
            {
                return _exThemeResourceDictionaryPath;
            }
            set
            {
                if (_exThemeResourceDictionaryPath != value)
                {
                    _exThemeResourceDictionaryPath = value;
                    RaisePropertyChanged("ExThemeResourceDictionaryPath");
                }
            }
        }

        string _themeResourceDictionaryPath;
        public string ThemeResourceDictionaryPath
        {
            get
            {
                return _themeResourceDictionaryPath;
            }
            set
            {
                if (_themeResourceDictionaryPath != value)
                {
                    ExThemeResourceDictionaryPath = _themeResourceDictionaryPath;
                    _themeResourceDictionaryPath = value;
                    RaisePropertyChanged(() => ThemeResourceDictionaryPath);
                }
            }
        }

        bool _enableShakeToRefresh;
        public bool EnableShakeToRefresh
        {
            get { return _enableShakeToRefresh; }
            set
            {
                _enableShakeToRefresh = value;
                RaisePropertyChanged("EnableShakeToRefresh");
            }
        }

        bool _enableOrientationChange = true;

        public bool EnableOrientationChange
        {
            get { return _enableOrientationChange; }
            set
            {
                _enableOrientationChange = value;
                RaisePropertyChanged("EnableOrientationChange");

            }
        }

        private int _currentOrientation = 1;

        public int CurrentOrientation
        {
            get { return _currentOrientation; }
            set
            {
                _currentOrientation = value;
                RaisePropertyChanged("CurrentOrientation");
            }
        }

        private int _currentSupportedOrientation = 3;

        public int CurrentSupportedOrientation
        {
            get { return _currentSupportedOrientation; }
            set
            {
                _currentSupportedOrientation = value;
                RaisePropertyChanged("CurrentSupportedOrientation");
            }
        }

        private string _version;

        public string Version
        {
            get { return _version; }
            set
            {
                _version = value;
                RaisePropertyChanged("Version");
            }
        }
    }
}
